import http from "../request"
const apibase = "/api/ProSegment"
import qs from 'qs'
//获取设备类型
var getProSegmentTypeList = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/GetProSegmentTypeList`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 新增设备类型 */
var insProSegmentType = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/InsProSegmentType`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 修改设备类型 */
var updProSegmentType = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/UpdProSegmentType`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 删除设备类型 */
var delProSegmentType = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/DelProSegmentType`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}
/** 查询绑定的工作集 */
var getJobProSegmentTypeRelationsList = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/GetJobProSegmentTypeRelationsList`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 新增工作集 */
var insJobProSegmentTypeRelations = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/InsJobProSegmentTypeRelations`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 解绑工作集 */
var delJobProSegmentTypeRelations = function (data) {
    return new Promise((resolve, reject) => {
        http.post(apibase + `/DelJobProSegmentTypeRelations`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 下载导入设备类型模板 */
var downloadProSegmentType = function (data) {
    return new Promise((resolve, reject) => {
        http.get(apibase + `/DownloadProSegmentType`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 导入设备类型模板 */
var importProSegmentType = function (data) {
    return new Promise((resolve, reject) => {
        http.Filepost(apibase + `/ImportProSegmentType`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 查询设备 */
var getProSegmentList = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/GetProSegmentList`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 新增设备 */
var insProSegment = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/InsProSegment`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 修改设备 */
var updProSegment = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/UpdProSegment`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}

/** 作废设备 */
var disProSegment = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/DisProSegment`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}


/** 获取生产拉线 */
var getProductLineList = function (data) {

    return new Promise((resolve, reject) => {
        http.post(apibase + `/GetProductLineList`, data)
            .then(res => {
                resolve(res)
            })
            .catch(error => {
                reject(error)
            })
    })
}
export {
    getProSegmentTypeList,
    insProSegmentType,
    updProSegmentType,
    delProSegmentType,
    getJobProSegmentTypeRelationsList,
    insJobProSegmentTypeRelations,
    delJobProSegmentTypeRelations,
    downloadProSegmentType,
    importProSegmentType,
    getProSegmentList,
    insProSegment,
    updProSegment,
    disProSegment,
    getProductLineList
}